<template>
  <div class="chat-interface">
    <!-- 左侧蓝色侧边栏 -->
    <div class="left-sidebar">
      <div class="user-section">
        <div class="user-avatar">
          <span class="status-dot"></span>
          <span class="user-text">试用</span>
        </div>
        <div class="user-status">在线</div>
      </div>
      
      <div class="stats-grid">
        <div class="stat-item">
          <div class="stat-number">1</div>
          <div class="stat-label">今日接待</div>
        </div>
        <div class="stat-item">
          <div class="stat-number">1</div>
          <div class="stat-label">本月接待</div>
        </div>
        <div class="stat-item">
          <div class="stat-number">0</div>
          <div class="stat-label">今日订单</div>
        </div>
        <div class="stat-item">
          <div class="stat-number">0</div>
          <div class="stat-label">今日订单</div>
        </div>
      </div>

      <div class="menu-section">
        <div class="menu-item">
          <span class="menu-icon">📋</span>
          <span class="menu-text">工作台</span>
        </div>
        <div class="menu-item active">
          <span class="menu-icon">💬</span>
          <span class="menu-text">消息</span>
          <span class="message-badge">1</span>
        </div>
        <div class="menu-item">
          <span class="menu-icon">📞</span>
          <span class="menu-text">通话</span>
        </div>
      </div>
    </div>

    <!-- 右侧主要内容区 -->
    <div class="main-content">
      <!-- 顶部标题栏 -->
      <div class="top-bar">
        <div class="timer-section">
          <span class="timer">剩余时长00:19:57</span>
        </div>
        <div class="control-buttons">
          <button class="control-btn">暂停</button>
          <button class="control-btn">重置</button>
          <button class="control-btn">设置</button>
          <button class="close-btn">×</button>
        </div>
      </div>

      <!-- 下方三栏布局 -->
      <div class="content-area">
        <!-- 聊天列表 -->
        <div class="chat-list-panel">
          <div class="search-area">
            <input type="text" placeholder="输入人名、群、聊天记录" class="search-input">
            <span class="search-icon">🔍</span>
          </div>
          
          <div class="tab-section">
            <div class="tab active">接待中 3</div>
            <div class="tab">联系时间 ↓</div>
          </div>

          <div class="chat-items">
            <div class="chat-item selected">
              <div class="avatar">👤</div>
              <div class="chat-info">
                <div class="name-time">
                  <span class="name">j****</span>
                  <span class="time">00:01</span>
                </div>
                <div class="preview">需要卡片</div>
              </div>
            </div>
            
            <div class="chat-item">
              <div class="avatar">👤</div>
              <div class="chat-info">
                <div class="name-time">
                  <span class="name">j****</span>
                  <span class="time">00:01</span>
                </div>
                <div class="preview">需要卡片</div>
              </div>
            </div>

            <div class="chat-item">
              <div class="avatar">👤</div>
              <div class="chat-info">
                <div class="name-time">
                  <span class="name">j****</span>
                  <span class="time">00:01</span>
                </div>
                <div class="preview">声音卡片</div>
              </div>
            </div>
          </div>
        </div>

        <!-- 聊天窗口 -->
        <div class="chat-window">
          <div class="chat-header">
            <div class="user-info">
              <div class="user-avatar-small">👤</div>
              <span class="username">j****</span>
              <span class="ai-tag">AI 智助</span>
            </div>
            <div class="header-buttons">
              <button class="header-btn primary">智能客服</button>
              <button class="header-btn">快速回复</button>
            </div>
          </div>

          <div class="messages">
            <div class="message">
              <div class="msg-avatar">👤</div>
              <div class="msg-content">
                <div class="msg-meta">
                  <span class="sender">j****</span>
                  <span class="timestamp">2025-05-23 09:06:30</span>
                </div>
                <div class="msg-bubble">有美的节能电热水器吗？</div>
              </div>
            </div>

            <div class="message">
              <div class="msg-avatar">🤖</div>
              <div class="msg-content">
                <div class="msg-meta">
                  <span class="sender">j****</span>
                  <span class="timestamp">2025-05-23 09:06:40</span>
                </div>
                <div class="msg-bubble">
                  <div class="product-info">
                    <strong>[链接完美型]</strong> 美的一级能效节能电热水器 用清洁卫生间洗澡C35
                  </div>
                  <div class="product-url">https://detail.tmall.com/item.htm?spm...</div>
                </div>
              </div>
            </div>
          </div>

          <div class="input-area">
            <div class="toolbar">
              <button class="tool-btn">😊</button>
              <button class="tool-btn">📁</button>
              <button class="tool-btn">📷</button>
              <button class="tool-btn">🎤</button>
            </div>
            <div class="input-row">
              <textarea class="message-input" placeholder="输入消息..."></textarea>
              <button class="send-btn">发送</button>
            </div>
          </div>
        </div>

        <!-- 客户信息面板 -->
        <div class="customer-panel">
          <div class="panel-header">
            <h3>客户信息</h3>
            <button class="panel-close">×</button>
          </div>
          
          <div class="customer-info">
            <div class="customer-basic">
              <span class="customer-name">j****</span>
              <div class="badges">
                <span class="badge success">好评100%</span>
                <span class="badge warning">信誉</span>
                <span class="badge warning">新客</span>
              </div>
            </div>

            <div class="info-rows">
              <div class="info-row">
                <span class="label">店铺消费：</span>
                <span class="value">¥-</span>
                <span class="label">平均客单价：</span>
                <span class="value">¥-</span>
                <span class="label">优惠券：</span>
                <span class="value">( )</span>
              </div>
              
              <div class="info-row">
                <span class="label">买家信用：</span>
                <span class="value">🔶</span>
                <span class="label">收到好评率：</span>
                <span class="value">100%</span>
              </div>
              
              <div class="info-row">
                <span class="label">买家信用：</span>
                <span class="value">——</span>
                <span class="label">发出好评率：</span>
                <span class="value">100%</span>
              </div>
              
              <div class="info-row">
                <span class="label">买家信用：</span>
                <span class="value">——</span>
                <span class="label">注册时间：</span>
                <span class="value">2015-11-12</span>
              </div>
            </div>

            <div class="action-buttons">
              <button class="action-btn">添加备注</button>
              <button class="action-btn">发收藏券</button>
              <button class="action-btn">适当人群</button>
            </div>

            <div class="panel-tabs">
              <button class="panel-tab active">咨询实页</button>
              <button class="panel-tab">记录</button>
              <button class="panel-tab">推荐</button>
            </div>
          </div>

          <div class="panel-footer">
            <p>充值赠功能</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SimulatorRoom'
}
</script>

<style scoped>
.chat-interface {
  display: flex;
  height: 100vh;
  font-family: Arial, sans-serif;
}

/* 左侧蓝色侧边栏 */
.left-sidebar {
  width: 60px;
  background: linear-gradient(180deg, #4285f4 0%, #1976d2 100%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.user-section {
  text-align: center;
  margin-bottom: 30px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  position: relative;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  right: 2px;
}

.user-text {
  font-size: 12px;
}

.user-status {
  font-size: 10px;
  opacity: 0.8;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 30px;
  width: 100%;
  padding: 0 10px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 8px;
  opacity: 0.8;
  line-height: 1.2;
}

.menu-section {
  width: 100%;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.menu-item:hover {
  background: rgba(255,255,255,0.1);
}

.menu-item.active {
  background: rgba(255,255,255,0.2);
}

.menu-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.menu-text {
  font-size: 10px;
}

.message-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #f44336;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 右侧主要内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

.top-bar {
  background: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
}

.timer {
  color: #f44336;
  font-weight: bold;
}

.control-buttons {
  display: flex;
  gap: 8px;
}

.control-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #999;
}

/* 下方三栏布局 */
.content-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 聊天列表面板 */
.chat-list-panel {
  width: 250px;
  background: white;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.search-area {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 30px 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}

.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

.tab-section {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: #4285f4;
  border-bottom-color: #4285f4;
}

.chat-items {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.chat-item:hover {
  background: #f9f9f9;
}

.chat-item.selected {
  background: #e3f2fd;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 16px;
}

.chat-info {
  flex: 1;
}

.name-time {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.name {
  font-weight: bold;
  font-size: 13px;
}

.time {
  font-size: 11px;
  color: #999;
}

.preview {
  font-size: 12px;
  color: #666;
}

/* 聊天窗口 */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.username {
  font-weight: bold;
  font-size: 14px;
}

.ai-tag {
  background: #4285f4;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.header-btn.primary {
  background: #4285f4;
  color: white;
  border-color: #4285f4;
}

.messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f9f9f9;
}

.message {
  display: flex;
  margin-bottom: 16px;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 16px;
}

.msg-content {
  flex: 1;
}

.msg-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
  font-size: 11px;
  color: #666;
}

.msg-bubble {
  background: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.product-info {
  margin-bottom: 8px;
}

.product-url {
  color: #4285f4;
  font-size: 11px;
}

.input-area {
  border-top: 1px solid #e0e0e0;
  padding: 12px 16px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tool-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.message-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  height: 50px;
  font-size: 13px;
}

.send-btn {
  background: #4285f4;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

/* 客户信息面板 */
.customer-panel {
  width: 280px;
  background: white;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
}

.panel-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #999;
}

.customer-info {
  padding: 16px;
  flex: 1;
}

.customer-basic {
  margin-bottom: 16px;
}

.customer-name {
  font-weight: bold;
  margin-right: 8px;
}

.badges {
  margin-top: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  margin-right: 4px;
}

.badge.success {
  background: #4caf50;
  color: white;
}

.badge.warning {
  background: #ff9800;
  color: white;
}

.info-rows {
  margin-bottom: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
}

.label {
  color: #666;
}

.value {
  color: #333;
}

.action-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.action-btn {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}

.panel-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  border-bottom: 2px solid transparent;
}

.panel-tab.active {
  color: #4285f4;
  border-bottom-color: #4285f4;
}

.panel-footer {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 11px;
  border-top: 1px solid #e0e0e0;
}
</style>